package com.youxue.teachin.set.main.maper;

import java.util.ArrayList;
import java.util.List;

import com.library.uiframework.utils.StringUtils;
import com.youxue.teachin.common.vo.UserVO;
import com.youxue.teachin.set.main.vo.KeyValueVO;
import com.youxue.teachin.set.main.vo.SheJiaoVO;
import com.youxue.teachin.set.main.vo.TitleVO;
import com.youxue.teachin.set.main.vo.UserHeadVO;
import com.youxue.teachin.set.main.vo.UserIconVO;

/**
 * 在此写用途
 *
 * @author: zhiwei
 * @date: 2017-10-06 08:53
 * @version: 9.1.0
 */
public class SetMaper {

    public static List transformUseDetail(UserVO userVO) {
        List list = new ArrayList(3);
        boolean isNotNull = userVO != null;
        UserIconVO iconVO = new UserIconVO();
        if (isNotNull) {
            iconVO.mIcon = userVO.avatar;
        }
        list.add(iconVO);

        KeyValueVO valueVO = new KeyValueVO(KeyValueVO.TYPE_NIKE_NAME, "昵称", "");
        if (isNotNull) {
            valueVO.mValue = userVO.getUsername();
        }
        list.add(valueVO);

        valueVO = new KeyValueVO(KeyValueVO.TYPE_JIESHAO, "介绍", "");
        if (isNotNull) {
            valueVO.mValue = userVO.introduce;
        }
        list.add(valueVO);

        return list;
    }

    public static List transformSet(UserVO userVO) {
        List list = new ArrayList();
        UserHeadVO headVO = new UserHeadVO();
        boolean isNotNull = userVO != null;
        list.add(headVO);
        if (isNotNull) {
            headVO.id = userVO.id;
            headVO.mName = userVO.getUsername();
            headVO.mIcon = userVO.avatar;
            headVO.mDestory = userVO.introduce;
        }

        list.add(new TitleVO("基本信息"));

        KeyValueVO valueVO = new KeyValueVO(KeyValueVO.TYPE_PHONE, "账号（手机号码）", "");
        if (isNotNull) {
            valueVO.mValue = userVO.phone;
        }
        list.add(valueVO);
        valueVO = new KeyValueVO(KeyValueVO.TYPE_XUEDUAN, "学段学科", "");
        if (isNotNull) {
            if (StringUtils.isEmpty(userVO.studySubjectId) && StringUtils.isEmpty(userVO.studyStagesId)) {

            } else {
                valueVO.mValue = userVO.studyStagesName + "." + userVO.studySubjectName;
            }

        }
        list.add(valueVO);
        valueVO = new KeyValueVO(KeyValueVO.TYPE_ARREA, "区域", "");
        if (isNotNull) {
            valueVO.mValue = userVO.area;
        }
        list.add(valueVO);

        list.add(new TitleVO("绑定社交账号"));

        SheJiaoVO sheJiaoVO = null;
        //sheJiaoVO = new SheJiaoVO(SheJiaoVO.TYPE_QQ, false, "QQ");
        //if (userVO != null) {
        //    sheJiaoVO.isConfirmed = userVO.isQqConfirmed == 1;
        //}
        //list.add(sheJiaoVO);
        sheJiaoVO = new SheJiaoVO(SheJiaoVO.TYPE_WECHAT, false, "微信");
        if (userVO != null) {
            sheJiaoVO.isConfirmed = userVO.isWeixinConfirmed == 1;
        }
        list.add(sheJiaoVO);
        //sheJiaoVO = new SheJiaoVO(SheJiaoVO.TYPE_WEIBO, false, "微博");
        //if (userVO != null) {
        //    sheJiaoVO.isConfirmed = userVO.isWeiboConfirmed == 1;
        //}
        //list.add(sheJiaoVO);
        return list;
    }
}
